//
//  ANScreenMacro.h
//  ShenWeiRent
//
//  Created by iMac on 2019/2/28.
//  Copyright © 2019年 liyefu. All rights reserved.
//

#ifndef ANScreenMacro_h
#define ANScreenMacro_h

//手机屏幕判断
#define isiPhone4sScreen           (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(320, 480)))
#define isiPhone5Screen            (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(320, 568)))
#define isiPhone678Screen            (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 667)))
#define isiPhone678PScreen           (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 736)))
#define isiPhoneXScreen           (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)))
#define isiPhoneXRMAXScreen           (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 896)))

//设备检测(iPhone4为iPad做了特殊处理)
#define iPad    ([[UIDevice currentDevice].model rangeOfString:@"iPad"].location != NSNotFound)
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO) || (iPad)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
/** iPhone6Plus放大模式 */
#define iPhone6PlusA ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhoneXMAX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)

//设备种类判断
#define isSimulator                (NSNotFound != [[[UIDevice currentDevice] model] rangeOfString:@"Simulator"].location)
#define isiPhone                   (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define isiPad                     (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

//系统版本判断
#define isIOS7                     ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define isIOS8                     ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
#define isIOS9                     ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0)
#define isIOS10                     ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0)
#define isIOS11                     ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0)
#define isIOS12                     ([[[UIDevice currentDevice] systemVersion] floatValue] >= 12.0)

//屏幕尺寸
#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height
#define kStatusFrame [[UIApplication sharedApplication] statusBarFrame]
#define kStatusAndNavBarHeight  (iPhoneX || iPhoneXMAX|| iPhoneXR ? 88 : 64)
#define kTabBarHeight      (iPhoneX || iPhoneXMAX|| iPhoneXR ? 83 : 49)
#define kiPhoneXInsetBottom (iPhoneX || iPhoneXMAX|| iPhoneXR ? 34 : 0)

#define kScale [UIScreen mainScreen].scale

#define kWidth(w) w/375.0*MIN(kScreenW, 375)

#endif /* ANScreenMacro_h */
